<?php
/**
 * Created by PhpStorm.
 * User: zhou
 * Date: 2017/4/10
 * Time: 17:36
 */

namespace Application\Dao;


class SiteDao extends MysqliTestDao
{
    /**
     * 提供数据表名
     * @return string
     */
    protected  function _provideTableName() {
        return 't_site';
    }

    public function contSite(){
        $sql = "SELECT COUNT(0) FROM t_site";
        return $this->queryBySql($sql);
    }

    public function pageAll($page,$pageSize){
        $sql = "SELECT * FROM t_site ";
        $where = " ORDER BY t_site.id DESC LIMIT ".($page - 1)*$pageSize .",".$pageSize;
        $sqls = $sql.$where;
        return $this->queryBySql($sqls);
    }

    public function delete($id){
        $sql = "DELETE FROM t_site WHERE id = '{$id}'";
        return $this->queryBySql($sql);
    }
}